<?php

namespace app\admin\controller;

 // 核销员
 use app\admin\service\VerifierService;

class VerifierController extends CommonController
{
    // 获取核销员数据的分页列表
    public function getVerifierList(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(VerifierService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->getList();
        return $this->return_result($this->returnData);
    }

    // 添加核销员
    public function toAddVerifier(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(VerifierService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->toAdd();
        return $this->return_result($this->returnData);
    }

    // 更新核销员
    public function toUpdateVerifier(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(VerifierService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->toUpdate();
        return $this->return_result($this->returnData);
    }

    // 通过模板文件导入数据
    public function toImportData(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(VerifierService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->toImportByExcel();
        return $this->return_result($this->returnData);
    }

    // 下载导入模板文件
    public function getImportTemplate(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(VerifierService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->toExportByExcel();
        return $this->return_result($this->returnData);
    }

    // 核销员的详细内容
    public function getVerifierDetail(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(VerifierService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->getDetail();
        return $this->return_result($this->returnData);
    }

    // 更新司机上下线状态
    public function toUpdateStatus(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(VerifierService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->toUpdateStatus();
        return $this->return_result($this->returnData);
    }

    // 删除核销员
    public function toDelVerifier(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(VerifierService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->toDel();
        return $this->return_result($this->returnData);
    }

}